package com.tdtxdcxm.mynotepad.listcontaineritem;

import java.io.File;

public class NoteListItem {
    private String text = null;
    private File file = null;
    private String notedate = null;

    public NoteListItem(String text,File file) {
        this.text = text;
        this.file = file;
        getNoteDate();
    }

    public String getText() {
        return text;
    }

    public File getFile() {
        return file;
    }

    public String getNoteDate() {
        System.out.println("getNote file:"+file);
        if(file != null){
            notedate = file.getParentFile().getName();
        }
        return notedate;
    }

    public String getShortText(){
        getNoteDate();
        System.out.println("getshorttext检查："+text+","+notedate+","+file.toString());
        if(text != null && notedate != null && file != null){

            return notedate+"\n"+text;
        }
        return "error";
    }
}